package com.tinyideatech.framework.dto;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
@Data
public class FTP {

    @Value("${ftp.host}")
    private String ftpHost;

    @Value("${ftp.catalog}")
    private String ftpCatalog;

    @Value("${ftp.imgTargetDir}")
    private String imgTargetDir;

    @Value("${ftp.modTargetDir}")
    private String modTargetDir;

    public String getFullPathImgFtp() {
        if (ftpCatalog == null || ftpCatalog.equals("")) {
            return "ftp://" + ftpHost.concat("/" + imgTargetDir + "/");
        }
        return "ftp://" + ftpHost.concat("/" + ftpCatalog + "/" + imgTargetDir + "/");
    }

    public String getFullPathMODFtp() {
        if (ftpCatalog == null || ftpCatalog.equals("")) {
            return "ftp://" + ftpHost.concat("/" + modTargetDir + "/");
        }
        return "ftp://" + ftpHost.concat("/" + ftpCatalog + "/" + modTargetDir + "/");
    }

    public String getFTPPathImgFtp() {
        if (ftpCatalog == null || ftpCatalog.equals("")) {
            return "/" + imgTargetDir;
        }
        return "/" + ftpCatalog + "/" + imgTargetDir + "/";
    }

}
